import globals from "globals";
import pluginJs from "@eslint/js";
import pluginVue from "eslint-plugin-vue";

/** @type {import('eslint').Linter.Config[]} */
export default [
  {
    files: ["**/*.{js,mjs,cjs,vue}"],
    rules: {
      // 基础规则
      "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
      "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
      semi: ["error", "always"],
      quotes: ["error", "single"],
      indent: ["error", 2],

      // Vue 相关规则
      "vue/html-indent": ["error", 2],
      "vue/html-quotes": ["error", "double"],
      "vue/multi-word-component-names": "error",
      "vue/no-unused-components": "warn",
      "vue/script-indent": ["error", 2],
      "vue/max-attributes-per-line": [
        "error",
        {
          singleline: 3,
          multiline: 1,
        },
      ],
    },
  },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...pluginVue.configs["flat/essential"],
];
